<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AI智能签到系统</title>

    <link rel="stylesheet" href="/static/lib/css/layui.css">
    <style>
        /* 移动端  (cao 找了好久才从控制台找到这段代码……)*/
        @media screen and (max-width: 768px) {
    
            .layui-layout-admin .layui-layout-left,
            .layui-layout-admin .layui-body,
            .layui-layout-admin .layui-footer {
                left: 0;
            }
    
            .layui-layout-admin .layui-side {
                left: -300px;
            }
        }
    </style>
</head>
<script src="/static/lib/axios.min.js"></script>
<body>
    <div class="layui-layout layui-layout-admin">
        <div class="layui-header">
            <div class="layui-logo layui-hide-xs layui-bg-black">AI智能签到系统</div>
            <!-- 头部区域（可配合layui 已有的水平导航） -->
            <ul class="layui-nav layui-layout-left">
                <!-- 移动端显示 -->
                <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-header-event="menuLeft">
                    <i class="layui-icon layui-icon-spread-left"></i>
                </li>
            </ul>
            <ul class="layui-nav layui-layout-right">
                <li class="layui-nav-item layui-hide layui-show-md-inline-block">
                    <a href="javascript:;">
                        <img src="/static/images/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg"
                            class="layui-nav-img">
                        {{username}}
                    </a>
                    <dl class="layui-nav-child">
                        <dd onclick="loginOff()" style="cursor: pointer;"><a>退出登录</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item" lay-header-event="" lay-unselect>
                    <a href="javascript:;">
                        <i class="layui-icon layui-icon-more-vertical"></i>
                    </a>
                </li>
            </ul>
        </div>

        <div class="layui-side layui-bg-black">
            <div class="layui-side-scroll">
                <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
                <ul class="layui-nav layui-nav-tree" lay-filter="test">
                    <li class="layui-nav-item layui-nav-itemed">
                        <a class="" href="javascript:;">我的</a>
                        <dl class="layui-nav-child">
                            <dd onclick="changesrc('{% url 'aiAttendance:upload' %}')"><a href="#更新图片">更新图片</a></dd>
                            <dd onclick="changesrc('{% url 'aiAttendance:doregister' %}')"><a href="#进行签到">进行签到</a></dd>
                        </dl>
                    </li>
                    <li class="layui-nav-item" onclick="changesrc('{% url 'aiAttendance:checkmyregister' %}')"><a href="#查看签到情况">查看签到情况</a></li>
                </ul>
            </div>
        </div>

        <div class="layui-body">
            <!-- 内容主体区域 -->
            <div style="padding: 15px 5px 5px 15px;">
                <iframe id="iframe" src="{% url 'aiAttendance:checkmyregister' %}" style="width: 95%; height: 95%; border: 0; position: absolute;"></iframe>
            </div>
        </div>

        <div class="layui-footer" style="height: 0;">
            <!-- 底部固定区域 -->
        </div>
    </div>
    <script src="/static/lib/layui.js" charset="utf-8"></script>
    <script>
        //JS 
        layui.use(['element', 'layer', 'util'], function () {
            var element = layui.element
                , layer = layui.layer
                , util = layui.util
                , $ = layui.$;
            //头部事件
            util.event('lay-header-event', {
                //左侧菜单事件
                menuLeft: function (othis) {
                    layer.msg('展开左侧菜单的操作', { icon: 0 });
                },
            });
        });
    </script>
    <script>
        function loginOff() {
            axios({
                method: 'get',
                url: '../api/sign-out',
            })
                .then(function (response) {
                    console.log(response.data);
                    window.location = '../login'
                })
                .catch(function (error) {
                    console.log(error);
                });
        }
        function changesrc(src) {
            let iframe = document.getElementById("iframe");
            // iframe.contentWindow.location.reload(false);
            iframe.src = src;
        }
    </script>
</body>
</html>